<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = 12321
        var ispalindrome = function(x){
        var str = String(x)
        if (x >= 0) {
            for (var i = 0; i < str.length / 2; i++) {
                if (str[i] != str[str.length - 1 - i]) {
                    return false
                }
            }
            return true
        }
        else{
            return false
        }
    }
    console.log(ispalindrome(num));
    </script>
</body>

</html>